<?php 
namespace Home\Model;
use Think\Model;
class VerifyModel extends Model {

    /**
	 * [getOneVerify 随机获取一条人数验证]
	 * @Author   Xuebingsi
	 * @DateTime 2017-03-28T10:18:52+0800
	 * @return   [type]                   [description]
	 */
	public function getOneVerify()
	{

		$sql = "select * from verify order by rand() limit 1";
		
		$question = $this->query($sql);

		$question = current($question);
		//current() 函数返回数组中的当前元素的值

		$_SESSION['answer'] = $question['answer'];
		//把问题存到SESSION里

		// var_dump($question);exit; //测试有没有去到数据库
		return $question['question'];
	}


    }






















 ?>